package ch.ifage.business.dom;

import java.util.GregorianCalendar;

import junit.framework.Assert;

import org.junit.Before;
import org.junit.Test;

/**
 * teste la class firststep.
 * @author Christian
 *
 */
public class FirstStepTest {
	
	/**
	 * identité du step.
	 */
	private StepIdentity si = new StepIdentity(1, "serverY", "instanceZ");
	
	/**
	 * départ.
	 */
	private GregorianCalendar start = new GregorianCalendar();
	
	/**
	 * fin.
	 */
	private GregorianCalendar end = new GregorianCalendar();
	
	/**
	 * propriété du step.
	 */
	private StepProperties sp;
	
	/**
	 * before.
	 */
	@Before
	public void init() {		
		end.add(GregorianCalendar.SECOND, 2); // durée de 2 secondes
		sp = new StepProperties("fichier.xml", 
                start, end, 
                Activity.ROUTER, 
                "parameter", 
                Status.SUCCESS, 
                "log");
	}

	
	/**
	 * test constructeur FirstStep().
	 */
	@Test
	public final void testFirstStep() {
		FirstStep fsNew = new FirstStep(si, sp);
		Assert.assertTrue(fsNew.getIdentity().getUid() == 1);
	}

	/**
	 * test toString.
	 */
	@Test
	public final void testToString() {
		si.setUid(100);
		FirstStep fsNew = new FirstStep(si, sp);
		System.out.println("-------------------------");
		System.out.println("Test FirstStep toString ");
		System.out.println("-------------------------");
		System.out.println(fsNew.toString());
		System.out.println("-------------------------");
	}

}
